package cn.wolfcode.crm.web.controller;


import cn.wolfcode.crm.domain.AccountBook;
import cn.wolfcode.crm.qo.AccountBookObject;
import cn.wolfcode.crm.qo.PageResult;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.IAccountBookService;
import cn.wolfcode.crm.util.JSONResult;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("accountBook")
public class AccountBookController {
    @Autowired
    private IAccountBookService accountBookService;


    //查询所有部门
    @RequestMapping("selectAll")
    @ResponseBody
    public Object selectAll() {
        //将数据转换成json格式
        List<AccountBook> accountBooks = accountBookService.selectAll();

        return accountBooks;
    }

    @RequestMapping("query")
    @ResponseBody
    public Object list(@ModelAttribute("qo") AccountBookObject qo, Model model) {
        //将数据转换成json格式
        PageResult result = accountBookService.queryForList(qo);

        return result;
    }

    @RequestMapping("view")

    public String list1(Model model, Long id) {

        return "/accountBook/list";
    }





}
